package com.platform.manager.action;

import com.opensymphony.xwork2.ActionSupport;
import com.platform.common.logger.annotation.EnableLogger;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


/**
 * Created with IntelliJ IDEA.
 * User: wangyanginfo
 * Date: 12-8-21
 * Time: 下午5:36
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/")
@Service("indexAction")
public class IndexAction extends ActionSupport {

    @EnableLogger
    private Logger logger;

    private static final long serialVersionUID = 1L;

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }

    private List<String> list;

    @Action(value = "index", results = {@Result(name = "success", location = "/index.vm")})
    public String index() {
        logger.info("测试 Struts2 方法：index()");
        list = new ArrayList<String>();
        list.add("元素1");
        list.add("元素2");
        list.add("元素3");
        list.add("元素4");
        return SUCCESS;
    }

}
